package com.lexed.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lexed.pojo.Emp;

import net.minidev.json.JSONObject;

/**
 * Servlet implementation class Rolm
 */
public class Rolm extends HttpServlet {

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		Emp emp = (Emp)request.getSession().getAttribute("user");
		
		if(emp != null){
			JSONObject json = new JSONObject();
			json.put("uname", emp.getUname());
			json.put("prm", emp.getPrm());
			response.setContentType("Application/json;charset=utf-8");
			response.getWriter().println(json.toJSONString());
			
		}else{
			response.sendRedirect("login.html");
		}
		
	}

}
